const fs = require('fs')
const querystring = require('querystring')

module.exports = {
	index: (res) => {
		fs.readFile('./index.html', 'utf-8', (err, data) => {
			if (err) {
				res.setHeader('Content-type', 'text/html;charset=utf-8')
				res.write('<h5>404 NOT Found< h5 > ')
				res.end()
				return
			}

			res.write(data)
			res.end()
		})
	},
	user: (data, res) => {
		console.log(JSON.stringify(querystring.parse(data)))
		res.end(JSON.stringify(querystring.parse(data)))
	}
}
